package libaryinterface;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: YKH
 * Date: 2022-05-15
 * Time: 19:27
 * author:ReturnInterface
 */
public class ReturnInterface extends JFrame {
    public ReturnInterface() {
        //设置窗口
        super("归还界面");
        Container container = this.getContentPane();
        //创建标签
        //创建书名标签
        JLabel label = new JLabel("已借阅的书:");
        label.setBounds(50, 50, 150, 40);

        //设置标签字体
        Font font = new Font("黑体", Font.BOLD, 20);
        label.setFont(font);

        JLabel label1 = new JLabel("  书名       作者     出版社       编号      分类号    借阅情况");
        //label.setBounds(1, 1, 600, 40);

        //设置标签字体
        label1.setFont(font);
        //创建面板
        JPanel jPanel1 = new JPanel();
        jPanel1.setLayout(new GridLayout(8,6));
        jPanel1.setBounds(100,100,700,600);
        jPanel1.setBackground(new Color(250, 246, 238));
        jPanel1.add(label1);

        //创建归还按钮
        JButton button1 = new JButton("归还");
        button1.setBounds(820,150,80,30);
        button1.setFont(font);
        //设置监听
        button1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                //弹窗
                new MyDialogDemo("归还成功");
            }
        });
        container.add(button1);
        //获得容器

        container.setBackground(new Color(50, 144, 236));
        setBounds(200,200,1000,800);
        container.setLayout(null);
        //添加
        container.add(label);
        container.add(jPanel1);

        setVisible(true);
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    }
}
